package kr.co.choongang;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

public class Uploadimpl implements UploadDao{
	
	public void moveFile(String source, String target){
		FileInputStream inputsteam = null;
		FileOutputStream outputsteam = null;
		FileChannel uploadin = null;
		FileChannel uploadout = null;

		try {
			inputsteam = new FileInputStream(source);
			outputsteam = new FileOutputStream(target);
			uploadin = inputsteam.getChannel();
			uploadout = outputsteam.getChannel();
		
		long size = uploadin.size();
		uploadin.transferTo(0, size, uploadout);
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			
			try {
				uploadout.close();
			} catch (IOException e) {}
			try {	uploadin.close();
			} catch (IOException e) {}
			try {outputsteam.close();
			} catch (IOException e) {}
			try {inputsteam.close();
			} catch (IOException e) {}
		}	
	}

}



